package com.aneliya.formatter;

import java.text.SimpleDateFormat;

import com.aneliya.model.Message;

public class MessageFormatImpl implements IFormatImpl {
	public static final String DATE_PATTERN = "dd/MM/yyyy hh:mm:ss a";
	
	public String format(Object data) {
		Message message = (Message) data;
		SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_PATTERN);
		String result = dateFormat.format(message.getDate()) + " " + message.getUsername() + ": " + message.getMessage();
		return result;
	}

}
